<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>视频会员优惠</title>
    <link rel="stylesheet" href="css/style.min.css">
    <script src="js/jquery-2.1.0.js"></script>
    <script src="js/config.js"></script>
</head>

<body>
<div id="app">
    <div class="header">
        <img style="display: block;" src="image/header_vvip_bg.png"
             width="100%">
        <a id="kefu" href="kefu.html">客服</a>
        <div class="guize">活动规则</div>
        <!-- <div class="timedown-row timeMs"><span class="time_bg">{{parseInt(timedown /
                60)}}</span>:<span class="time_bg">{{timedown % 60}}</span>:<span class="time_bg">{{timeMs}}</span>
        </div> -->
    </div>
    <div class="body">
        <div class="block1">
            <div class="input-outer">
                <input type="tel" autocomplete="off" class="input" placeholder="请输入您的手机号码" maxlength="11" id="textphone"
                       />
            </div>
            <div class="video_list">
                <img src="image/uku.png" class="video_item1">
                <img src="image/iqiyi.png" class="video_item2">
                <img src="image/yangsp.png" class="video_item3">
            </div>
        </div>
        <div class="block1">
            <div class="black_tt">支付金额：</div>
            <div class="gray_text">实际支付金额：<span class="blue_text">0.20元</span></div>
            <div class="gray_text">充值实际抵扣金额：<span class="blue_text">12元</span></div>
        </div>
        <div class="btn_block pay_phone_number_button">
            <span class="hover_price">0.20元</span>
            立即支付
        </div>
        <div class="block1">
            <div class="black_tt">黄金会员月卡充值抵扣券说明</div>
            <div class="gray_text">1、充值抵扣券仅应用于会员月卡充值；</div>
            <div class="gray_text">2、购买成功后，使用登记的手机号登陆对应的视频平台充值会员，即可用券抵扣。</div>
            <div class="gray_text">3、充值门槛:单笔充值可使用1次12元充值券</div>
            <div class="gray_text">4、充值中如遇特殊情况请联系客服</div>
        </div>
    </div>
    <!-- 规则 -->
    <div class="dialog" style="display: none;">
        <div class="dialog-inner">
            <div class="rule-box">
                <h3 class="rule-box-title">规则说明</h3>
                <div>
                    活动规则：
                    <br>活动时间:2024年1月1日-2024年12月31日
                    <br>1. 视频会员优惠券活动，只要0.2元就可以购买对应的视频平台会员优惠券（目前支持爱奇艺，芒果TV，优酷和腾讯视频）。
                    <br>2. 购买时，输入您的视频平台账号手机号，优惠券会自动充值到您的账户中，用来您在购买会员时抵扣使用。
                    <br>3. 有任何问题，可以拨打号：010-53396307 联系客服。
                    <br>4. 如充值失败或者放弃优惠券，请联系客服全额退款，请勿投诉，谢谢您的支持！
                </div>
            </div>
        </div>
    </div>
    <div class="hide"></div>
</div>
</body>
<script src="js/vue@2.js"></script>
<script src="js/utils.min.js"></script>
<script>
    //获取url参数
    function getUrlParams(index = '') {
        const params = {};
        const url = window.location.href;
        const urlObj = new URL(url);
        for (const [key, value] of urlObj.searchParams.entries()) {
            if(index && index === key){
                return value;
            }
            params[key] = value;
        }
        return params;
    }

    $(function (){
        //判断来源
        let params = getUrlParams();
        let source = '';
        let sourceLicense = '';

        if(params['qcjParamStr']){
            source = 'qcjParamStr';
            sourceLicense = params['qcjParamStr'];
        }else if(params['bxm_id']){
            source = 'bxmid';
            sourceLicense = params['bxm_id'];
        }else if(params['a_oId']){
            source = 'tuia';
            sourceLicense = params['a_oId'];
        }

        if(params['phone']){
            let phone = atob(params['phone']);
            if(phone){
                $("#textphone").val(phone);
            }
        }

        $('.pay_phone_number_button').on('click', function () {
            let phone = $('#textphone').val();
            var regex = /^1\d{10}$/;
            if(! regex.test(phone)){
                alert("请输入正确的手机号");
                return false;
            }

            $.ajax({
                type : 'POST',
                url : domain + '/api/bu/setOrder',
                data : {
                    phone: phone,
                    source: source,
                    sourceLicense: sourceLicense
                },
                success : function (res) {
                    if(res.code === 1){
                        location.href = res.data.url;
                    }else{
                        alert(res.msg);
                    }
                }
            });
        });

        $(".guize").on('click', function (){
            $('.dialog').show();
        });
        $('.dialog').on('click', function () {
            $('.dialog').hide();
        })
    })
</script>
</html>